#后台管理子路由文件
from django.urls import include, path

from myadmin.views import dashboard, dietplan, foodcategories, foods, index, nutritionistadvice, recipes, systemnotice
from myadmin.views import users, userbodyrecords, recommendations, userdietrecords, userpreferences, userfeedback

urlpatterns = [
    path('', index.index,name="myadmin_index"),  #后台首页

    #后台管理员登录、退出路由
    path('login', index.login,name="myadmin_login"),  #加载登录表单
    path('dologin', index.dologin,name="myadmin_dologin"),  #加载登录表单
    path('logout', index.logout,name="myadmin_logout"),  #加载登录表单
    path('verify', index.verify,name="myadmin_verify"),  #输出验证码
    path('introduction', index.introduction,name="myadmin_introduction"), #图标点击出现的介绍页面
    
    # 控制面板各模块详情页
    path('dashboard/daily-compliance/', dashboard.daily_compliance_detail, name='myadmin_daily_compliance_detail'),
    path('dashboard/new-users/', dashboard.new_users_detail, name='myadmin_new_users_detail'),
    path('dashboard/pending-diets/', dashboard.pending_diets_detail, name='myadmin_pending_diets_detail'),
    path('dashboard/system-notices/', dashboard.system_notices_detail, name='myadmin_system_notices_detail'),

    # 控制面板数值刷新
    path('dashboard/system-notices/count/', dashboard.system_notices_count, name='myadmin_system_notices_refresh'),
    path('dashboard/daily-compliance/count/', dashboard.daily_compliance_count, name='myadmin_daily_compliance_count'),
    path('dashboard/new-users/count/', dashboard.new_users_count, name='myadmin_new_users_count'),
    path('dashboard/pending-diets/count/', dashboard.pending_diets_count, name='myadmin_pending_diets_count'),

    #用户信息管理路由
    path('users/<int:pIndex>', users.index, name="myadmin_users_index"),#浏览
    path('users/add', users.add, name="myadmin_users_add"),#添加表单
    path('users/insert', users.insert, name="myadmin_users_insert"),#执行添加
    path('users/del/<int:uid>', users.delete, name="myadmin_users_delete"),#执行删除
    path('users/edit/<int:uid>', users.edit, name="myadmin_users_edit"),#加载编辑表单
    path('users/update/<int:uid>', users.update, name="myadmin_users_update"),#执行编辑


    #用户健康数据管理路由
    path('userbodyrecords/<int:pIndex>', userbodyrecords.index, name="myadmin_userbodyrecords_index"),#浏览
    path('userbodyrecords/add', userbodyrecords.add, name="myadmin_userbodyrecords_add"),#添加表单
    path('userbodyrecords/insert', userbodyrecords.insert, name="myadmin_userbodyrecords_insert"),#执行添加
    path('userbodyrecords/del/<int:rid>', userbodyrecords.delete, name="myadmin_userbodyrecords_delete"),#执行删除
    path('userbodyrecords/edit/<int:rid>', userbodyrecords.edit, name="myadmin_userbodyrecords_edit"),#加载编辑表单
    path('userbodyrecords/update/<int:rid>', userbodyrecords.update, name="myadmin_userbodyrecords_update"),#执行编辑


    # 食物类别管理路由
    path('foodcategories/<int:pIndex>/', foodcategories.index, name="myadmin_foodcategories_index"),
    path('foodcategories/add/', foodcategories.add, name="myadmin_foodcategories_add"),
    path('foodcategories/insert/', foodcategories.insert, name="myadmin_foodcategories_insert"),
    path('foodcategories/edit/<int:cid>/', foodcategories.edit, name="myadmin_foodcategories_edit"),
    path('foodcategories/update/<int:cid>/', foodcategories.update, name="myadmin_foodcategories_update"),
    path('foodcategories/delete/<int:cid>/', foodcategories.delete, name="myadmin_foodcategories_delete"),


    #食物管理路由
    path('foods/<int:pIndex>', foods.index, name="myadmin_foods_index"),#浏览
    path('foods/add', foods.add, name="myadmin_foods_add"),#添加表单
    path('foods/insert', foods.insert, name="myadmin_foods_insert"),#执行添加
    path('foods/del/<int:fid>', foods.delete, name="myadmin_foods_delete"),#执行删除
    path('foods/edit/<int:fid>', foods.edit, name="myadmin_foods_edit"),#加载编辑表单
    path('foods/update/<int:fid>', foods.update, name="myadmin_foods_update"),#执行编辑


    # 饮食计划管理路由
    path('dietplan/<int:pIndex>', dietplan.index, name="myadmin_dietplan_index"),#浏览
    path('dietplan/add', dietplan.add, name="myadmin_dietplan_add"),#添加表单
    path('dietplan/insert', dietplan.insert, name="myadmin_dietplan_insert"),#执行添加
    path('dietplan/detail/<int:plan_id>', dietplan.detail, name="myadmin_dietplan_detail"),#查看详情
    path('dietplan/edit/<int:plan_id>', dietplan.edit, name="myadmin_dietplan_edit"),#加载编辑表单
    path('dietplan/update/<int:plan_id>', dietplan.update, name="myadmin_dietplan_update"),#执行编辑
    path('dietplan/del/<int:plan_id>', dietplan.delete, name="myadmin_dietplan_delete"),#详情


    # 饮食计划详情项相关路由
    path('dietplan/detail/add/<int:plan_id>', dietplan.detail_add, name="myadmin_dietplan_detail_add"),#添加详情项表单
    path('dietplan/detail/insert/<int:plan_id>', dietplan.detail_insert, name="myadmin_dietplan_detail_insert"),#执行添加详情项
    path('dietplan/detail/edit/<int:detail_id>', dietplan.detail_edit, name="myadmin_dietplan_detail_edit"),#编辑详情项表单
    path('dietplan/detail/update/<int:detail_id>', dietplan.detail_update, name="myadmin_dietplan_detail_update"),#执行编辑详情项
    path('dietplan/detail/del/<int:detail_id>', dietplan.detail_delete, name="myadmin_dietplan_detail_delete"),#删除详情项


    # 食谱管理路由
    path('recipes/<int:pIndex>', recipes.index, name="myadmin_recipes_index"),#浏览
    path('recipes/add', recipes.add, name="myadmin_recipes_add"),#添加表单
    path('recipes/insert', recipes.insert, name="myadmin_recipes_insert"),#执行添加
    path('recipes/detail/<int:recipe_id>', recipes.detail, name="myadmin_recipes_detail"),#查看详情
    path('recipes/edit/<int:recipe_id>', recipes.edit, name="myadmin_recipes_edit"),#加载编辑表单
    path('recipes/update/<int:recipe_id>', recipes.update, name="myadmin_recipes_update"),#执行编辑
    path('recipes/del/<int:recipe_id>', recipes.delete, name="myadmin_recipes_delete"),#详情


    # 食谱详情项相关路由
    path('recipes/ingredient/add/<int:recipe_id>', recipes.ingredient_add, name="myadmin_recipes_ingredient_add"),#添加详情项表单
    path('recipes/ingredient/insert/<int:recipe_id>', recipes.ingredient_insert, name="myadmin_recipes_ingredient_insert"),#执行添加详情项
    path('recipes/ingredient/edit/<int:ingredient_id>', recipes.ingredient_edit, name="myadmin_recipes_ingredient_edit"),#编辑详情项表单
    path('recipes/ingredient/update/<int:ingredient_id>', recipes.ingredient_update, name="myadmin_recipes_ingredient_update"),#执行编辑详情项
    path('recipes/ingredient/del/<int:ingredient_id>', recipes.ingredient_delete, name="myadmin_recipes_ingredient_delete"),#删除详情项


    # 用户健康数据管理路由
    path('userdietrecords/<int:pIndex>', userdietrecords.index, name="myadmin_userdietrecords_index"),#浏览
    path('userdietrecords/add', userdietrecords.add, name="myadmin_userdietrecords_add"),#添加表单
    path('userdietrecords/insert', userdietrecords.insert, name="myadmin_userdietrecords_insert"),#执行添加
    path('userdietrecords/del/<int:rid>', userdietrecords.delete, name="myadmin_userdietrecords_delete"),#执行删除
    path('userdietrecords/edit/<int:rid>', userdietrecords.edit, name="myadmin_userdietrecords_edit"),#加载编辑表单
    path('userdietrecords/update/<int:rid>', userdietrecords.update, name="myadmin_userdietrecords_update"),#执行编辑


    # 营养顾问建议管理路由
    path('nutritionistadvice/<int:pIndex>', nutritionistadvice.index, name="myadmin_nutritionistadvice_index"),
    path('nutritionistadvice/feedback/<int:aid>', nutritionistadvice.feedback, name="myadmin_nutritionistadvice_feedback"),
    path('nutritionistadvice/do_feedback/<int:aid>', nutritionistadvice.do_feedback, name="myadmin_nutritionistadvice_do_feedback"),


    # 推荐食谱管理路由
    path('recommendations/<int:pIndex>', recommendations.index, name="myadmin_recommendations_index"),#浏览
    path('recommendations/add', recommendations.add, name="myadmin_recommendations_add"),#添加表单
    path('recommendations/insert', recommendations.insert, name="myadmin_recommendations_insert"),#执行添加
    path('recommendations/del/<int:rid>', recommendations.delete, name="myadmin_recommendations_delete"),#执行删除
    path('recommendations/edit/<int:rid>', recommendations.edit, name="myadmin_recommendations_edit"),#加载编辑表单
    path('recommendations/update/<int:rid>', recommendations.update, name="myadmin_recommendations_update"),#执行编辑


    # 饮食偏好管理路由
    path('userpreferences/<int:pIndex>', userpreferences.index, name="myadmin_userpreferences_index"),#浏览
    path('userpreferences/add', userpreferences.add, name="myadmin_userpreferences_add"),#添加表单
    path('userpreferences/insert', userpreferences.insert, name="myadmin_userpreferences_insert"),#执行添加
    path('userpreferences/del/<int:pid>', userpreferences.delete, name="myadmin_userpreferences_delete"),#执行删除
    path('userpreferences/edit/<int:pid>', userpreferences.edit, name="myadmin_userpreferences_edit"),#加载编辑表单
    path('userpreferences/update/<int:pid>', userpreferences.update, name="myadmin_userpreferences_update"),#执行编辑
    

    # 用户反馈管理路由
    path('userfeedback/<int:pIndex>', userfeedback.index, name="myadmin_userfeedback_index"),#浏览
    path('userfeedback/add', userfeedback.add, name="myadmin_userfeedback_add"),#添加表单
    path('userfeedback/insert', userfeedback.insert, name="myadmin_userfeedback_insert"),#执行添加
    path('userfeedback/del/<int:fid>', userfeedback.delete, name="myadmin_userfeedback_delete"),#执行删除
    path('userfeedback/edit/<int:fid>', userfeedback.edit, name="myadmin_userfeedback_edit"),#加载编辑表单
    path('userfeedback/update/<int:fid>', userfeedback.update, name="myadmin_userfeedback_update"),#执行编辑

    
    # 系统通知路由
    path('systemnotice/<int:pIndex>', systemnotice.index, name="myadmin_systemnotice_index"),#浏览
    path('systemnotice/add', systemnotice.add, name="myadmin_systemnotice_add"),#添加表单
    path('systemnotice/insert', systemnotice.insert, name="myadmin_systemnotice_insert"),#执行添加
    path('systemnotice/del/<int:nid>', systemnotice.delete, name="myadmin_systemnotice_delete"),#执行删除
    path('systemnotice/edit/<int:nid>', systemnotice.edit, name="myadmin_systemnotice_edit"),#加载编辑表单
    path('systemnotice/update/<int:nid>', systemnotice.update, name="myadmin_systemnotice_update"),#执行编辑

]
